### Election pledges in multiparty governments: When do voters accept non-fulfillment? ###
### Replication code for the analyses and figures reported in the Supplementary Material ###

# Please note that the scripts used for the tables in Appendix 4 are included in "data_analysis_maintext.R".

# Please change to your working directory:
setwd("//utuhome.utu.fi/jtylis/pledges-code-and-data")

## LOAD PACKAGES

# Data preparation and recoding:
library(readxl)
library(data.table)
library(stats)
library(forcats)
library(fastDummies)

# Variable labels:
library(sjlabelled)

# Linear regression with clustered standard errors ('lm_robust' function):
library(estimatr)

# Plots:
library(sjPlot)
library(ggplot2)
library(cowplot)

# Interaction plots with marginal effects (plot_cme):
library(marginaleffects)

# Results tables:
library(texreg)

# Principal component analysis:
library(psych)
library(GPArotation)

# Averages at different factor levels:
library(Rmisc)

## APPENDIX 1: DESCRIPTIVE STATISTICS ##
## Note: Tables S1 and S2 were created manually

# FINLAND

# Import the Finnish dataset in 'wide' format:
data_fin_wide <- read_excel("data_fin_wide.xlsx")

# Make the data a "data.table":
data_fin_wide.dt <- data.table(data_fin_wide)

# Filter out non-citizens and those who did not finish the survey:
data_fin_wide.dt <- subset(data_fin_wide.dt, citizenship==1&Finished==2)

# Define the categorical variables as factors
# Age group:
data_fin_wide.dt$agegroup4_f <- factor(data_fin_wide.dt$agegroup4,
                                       levels=c(1,2,3,4),
                                       labels=c("18-34", "35-49", "50-64", "65+"))

# Education:
data_fin_wide.dt$edu3_f <- factor(data_fin_wide.dt$edu3,
                                  levels=c(1,2,3),
                                  labels=c("Primary", "Secondary", "Tertiary"))

# Gender (differentiate those identifying as female from the rest):
data_fin_wide.dt$gender_f <- factor(data_fin_wide.dt$gender,
                                    levels=c(1,2,3),
                                    labels=c("Male", "Female", "Other/prefer not to disclose"))
data_fin_wide.dt$female_f <- fct_collapse(data_fin_wide.dt$gender_f,
                                          Female=c("Female"),
                                          Not_female=c("Male", "Other/prefer not to disclose"))

# Language:
data_fin_wide.dt$language_f <- factor(data_fin_wide.dt$language,
                                      levels=c(1,2),
                                      labels=c("Finnish", "Swedish"))

# Government supporter:
data_fin_wide.dt$voteintention_f <- factor(data_fin_wide.dt$voteintention,
                                           levels=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
                                           labels=c(
                                             "KOK", "PS", "SDP", "KESK", "VIHR", "VAS", "RKP",
                                             "KD", "LIIK", "Other",
                                             "Would not vote", "Cannot say", "Prefer not to disclose"
                                           ))
data_fin_wide.dt$governmentsupporter_f <- fct_collapse(data_fin_wide.dt$voteintention_f, 
                                                       Yes=c(
                                                         "KOK", "PS", "RKP", "KD"
                                                       ), 
                                                       No=c(
                                                         "SDP", "KESK", "VIHR", "VAS", "LIIK",
                                                         "Other", "Would not vote", "Cannot say",
                                                         "Prefer not to disclose")
)

# Left-right self-placement: recode 'don't knows' (11) to missing:
data_fin_wide.dt$leftright[data_fin_wide.dt$leftright==11] <- NA

# N's of the categorical variables:
summary(data_fin_wide.dt$agegroup4_f) # Age
summary(data_fin_wide.dt$edu3_f) # Education
summary(data_fin_wide.dt$female_f) # Gender
summary(data_fin_wide.dt$language_f) # Language
summary(data_fin_wide.dt$governmentsupporter_f) # Government supporter

# Descriptive statistics of the continuous variables:
summary(data_fin_wide.dt$leftright) # Left-right
sd(data_fin_wide.dt$leftright, na.rm = T) # Standard deviation: left-right
summary(data_fin_wide.dt$trustparties) # Trust in parties
sd(data_fin_wide.dt$trustparties, na.rm = T) # Standard deviation: trust in parties

# GERMANY

# Load the German dataset in 'wide' format:
data_ger_wide <- read_excel("data_ger_wide.xlsx")

# Make the dataset a "data table":
data_ger_wide.dt <- data.table(data_ger_wide)

# Define the categorical variables as factors
# Age group:
data_ger_wide.dt$agegroup4_f <- factor(data_ger_wide.dt$agegroup4,
                                       levels=c(1,2,3,4),
                                       labels=c("18-34", "35-49", "50-64", "65+"))

# Education:
data_ger_wide.dt$edu3_f <- factor(data_ger_wide.dt$edu3,
                                  levels=c(1,2,3),
                                  labels=c("Primary", "Secondary", "Tertiary"))

# Gender: differentiate those identifying as female from the rest
data_ger_wide.dt$gender_f <- factor(data_ger_wide.dt$gender,
                                    levels=c(1,2,3),
                                    labels=c("Male", "Female", "Other/prefer not to disclose"))
data_ger_wide.dt$female_f <- fct_collapse(data_ger_wide.dt$gender_f,
                                          Female=c("Female"),
                                          Not_female=c("Male", "Other/prefer not to disclose"))

# Government supporter:
data_ger_wide.dt$voteintention_f <- factor(data_ger_wide$voteintention, levels=c(1,2,3,4,5,6,7,8,9,10,11), 
                                           labels=c("SPD", "CDU/CSU", "B90/DG", "FDP", "AFD", 
                                                    "The Left", "Free Voters", "BSW", "Other", 
                                                    "Don't know", "Wouldn't vote"))
data_ger_wide.dt$governmentsupporter_f <- fct_collapse(data_ger_wide.dt$voteintention_f, 
                                                       Yes=c("SPD", "B90/DG", "FDP"), 
                                                       No=c("CDU/CSU",  "AFD", "The Left", 
                                                            "Free Voters", "BSW", "Other", 
                                                            "Don't know", "Wouldn't vote"))

# N's of the categorical variables:
summary(data_ger_wide.dt$agegroup4_f) # Age
summary(data_ger_wide.dt$edu3_f) # Education
summary(data_ger_wide.dt$female_f) # Gender
summary(data_ger_wide.dt$governmentsupporter_f) # Government supporter

# Descriptive statistics of the continuous variables:
summary(data_ger_wide.dt$leftright) # Left-right
sd(data_ger_wide.dt$leftright, na.rm = T) # Standard deviation: left-right
summary(data_ger_wide.dt$trustparties) # Trust in parties
sd(data_ger_wide.dt$trustparties, na.rm = T) # Standard deviation: trust in parties

## APPENDIX 2: RATIONALE FOR PLEDGE SELECTION ##

# PRINCIPAL COMPONENT ANALYSES
# Notes: Tables S3 and S4 were created manually. The original preliminary analyses
# were conducted using SPSS 29. The code below replicates the results in R.
# Some minor differences in the decimals remain, but these do not affect the conclusions.

# FINLAND
# Create a matrix containing the "opinion" variables, using listwise deletion of NAs:
data_fin_pca <- na.omit(data_fin_wide.dt[ , c(
  "opinion_1", "opinion_2", "opinion_3", "opinion_4", "opinion_5", "opinion_6")])

# Kaiser-Meyer-Olkin (KMO) measure of sampling adequacy:
kmo_fin <- KMO(data_fin_pca)
print(kmo_fin, digits=3)

# The number of components with eigenvalues >= 1 (extraction criterion):
eigenvalues_fin <- eigen(cor(data_fin_pca))$values
num_factors_fin <- sum(eigenvalues_fin >= 1)

fin_pca <- principal(data_fin_pca,
                     nfactors=num_factors_fin,
                     rotate="varimax",
                     scores=FALSE,
                     method="pc")

# PCA result:
print(fin_pca, digits=3)

# Initial eigenvalues:
print(eigenvalues_fin, digits=3)

# GERMANY

# Create a matrix containing the "opinion" variables, using listwise deletion of NAs:
data_ger_pca <- na.omit(data_ger_wide.dt[ , c(
  "opinion_1", "opinion_2", "opinion_3", "opinion_4", "opinion_5", "opinion_6")])

# Kaiser-Meyer-Olkin (KMO) measure of sampling adequacy:
kmo_ger <- KMO(data_ger_pca)
print(kmo_ger, digits=3)

# The number of components with eigenvalues >= 1 (extraction criterion):
eigenvalues_ger <- eigen(cor(data_ger_pca))$values
num_factors_ger <- sum(eigenvalues_ger >= 1)

# PCA with varimax rotation:
ger_pca <- principal(data_ger_pca,
                     nfactors=num_factors_ger,
                     rotate="varimax",
                     scores=FALSE,
                     method="pc")

# PCA result:
print(ger_pca, digits=3)

# Initial eigenvalues:
print(eigenvalues_ger, digits=3)

# FIGURE S1: Average left-right self placement (0 = left, 10 = right) in the Finnish survey, at different levels of the opinion variable

# Recode the opinion variables into factors in the 'wide' dataset:
data_fin_wide.dt$opinion_1_f <- factor(data_fin_wide.dt$opinion_1,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_fin_wide.dt$opinion_2_f <- factor(data_fin_wide.dt$opinion_2,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_fin_wide.dt$opinion_3_f <- factor(data_fin_wide.dt$opinion_3,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_fin_wide.dt$opinion_4_f <- factor(data_fin_wide.dt$opinion_4,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_fin_wide.dt$opinion_5_f <- factor(data_fin_wide.dt$opinion_5,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_fin_wide.dt$opinion_6_f <- factor(data_fin_wide.dt$opinion_6,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))

# Plot the average left-right self placement on different factor levels:
lr.opinion_1 <- summarySE(data_fin_wide.dt, measurevar="leftright", groupvars="opinion_1_f", na.rm=TRUE)
lr.opinion_1.plot <- ggplot(lr.opinion_1, aes(x=opinion_1_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Unemployment allowance", title="") + ylim(0, 10)

lr.opinion_2 <- summarySE(data_fin_wide.dt, measurevar="leftright", groupvars="opinion_2_f", na.rm=TRUE)
lr.opinion_2.plot <- ggplot(lr.opinion_2, aes(x=opinion_2_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Capital income tax", title="") + ylim(0, 10)

lr.opinion_3 <- summarySE(data_fin_wide.dt, measurevar="leftright", groupvars="opinion_3_f", na.rm=TRUE)
lr.opinion_3.plot <- ggplot(lr.opinion_3, aes(x=opinion_3_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Cannabis", title="") + ylim(0, 10)

lr.opinion_4 <- summarySE(data_fin_wide.dt, measurevar="leftright", groupvars="opinion_4_f", na.rm=TRUE)
lr.opinion_4.plot <- ggplot(lr.opinion_4, aes(x=opinion_4_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Fur farming", title="") + ylim(0, 10)

lr.opinion_5 <- summarySE(data_fin_wide.dt, measurevar="leftright", groupvars="opinion_5_f", na.rm=TRUE)
lr.opinion_5.plot <- ggplot(lr.opinion_5, aes(x=opinion_5_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Refugee quota", title="") + ylim(0, 10)

lr.opinion_6 <- summarySE(data_fin_wide.dt, measurevar="leftright", groupvars="opinion_6_f", na.rm=TRUE)
lr.opinion_6.plot <- ggplot(lr.opinion_6, aes(x=opinion_6_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Gender quotas", title="") + ylim(0, 10)

# Arrange into a grid:
leftright.grid_fin <- plot_grid(lr.opinion_1.plot, lr.opinion_2.plot, lr.opinion_3.plot, lr.opinion_5.plot, lr.opinion_4.plot, lr.opinion_6.plot, ncol=2)

# Print the grid (Figure S1):
print(leftright.grid_fin)

# FIGURE S2: Average left-right self placement (0 = left, 10 = right) in the German survey, at different levels of the opinion variable

# Recode the opinion variables into factors:
data_ger_wide.dt$opinion_1_f <- factor(data_ger_wide.dt$opinion_1,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_ger_wide.dt$opinion_2_f <- factor(data_ger_wide.dt$opinion_2,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_ger_wide.dt$opinion_3_f <- factor(data_ger_wide.dt$opinion_3,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_ger_wide.dt$opinion_4_f <- factor(data_ger_wide.dt$opinion_4,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_ger_wide.dt$opinion_5_f <- factor(data_ger_wide.dt$opinion_5,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))
data_ger_wide.dt$opinion_6_f <- factor(data_ger_wide.dt$opinion_6,
                                       levels=c(1,2,3,4,5),
                                       labels=c("FA", "SA", "NAND", "SD", "FD"))

# Plot the average left-right self placement on different factor levels:

lr.opinion_1_ger <- summarySE(data_ger_wide.dt, measurevar="leftright", groupvars="opinion_1_f", na.rm=TRUE)
lr.opinion_1_ger.plot <- ggplot(lr.opinion_1_ger, aes(x=opinion_1_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Military service", title="") + ylim(0, 10)

lr.opinion_2_ger <- summarySE(data_ger_wide.dt, measurevar="leftright", groupvars="opinion_2_f", na.rm=TRUE)
lr.opinion_2_ger.plot <- ggplot(lr.opinion_2_ger, aes(x=opinion_2_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Unemployment benefits", title="") + ylim(0, 10)

lr.opinion_3_ger <- summarySE(data_ger_wide.dt, measurevar="leftright", groupvars="opinion_3_f", na.rm=TRUE)
lr.opinion_3_ger.plot <- ggplot(lr.opinion_3_ger, aes(x=opinion_3_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Speed limit", title="") + ylim(0, 10)

lr.opinion_4_ger <- summarySE(data_ger_wide.dt, measurevar="leftright", groupvars="opinion_4_f", na.rm=TRUE)
lr.opinion_4_ger.plot <- ggplot(lr.opinion_4_ger, aes(x=opinion_4_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Debt brake", title="") + ylim(0, 10)

lr.opinion_5_ger <- summarySE(data_ger_wide.dt, measurevar="leftright", groupvars="opinion_5_f", na.rm=TRUE)
lr.opinion_5_ger.plot <- ggplot(lr.opinion_5_ger, aes(x=opinion_5_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Number of refugees", title="") + ylim(0, 10)

lr.opinion_6_ger <- summarySE(data_ger_wide.dt, measurevar="leftright", groupvars="opinion_6_f", na.rm=TRUE)
lr.opinion_6_ger.plot <- ggplot(lr.opinion_6_ger, aes(x=opinion_6_f, y=leftright)) + geom_errorbar(aes(ymin=leftright-sd, ymax=leftright+sd), width=.1) + geom_point() + scale_x_discrete(limits = c("FA", "SA", "NAND", "SD", "FD")) + labs(y="Left-right", x="Gender quotas", title="") + ylim(0, 10)

# Arrange into a grid:
leftright.grid_ger <- plot_grid(lr.opinion_3_ger.plot, lr.opinion_1_ger.plot, lr.opinion_4_ger.plot, lr.opinion_2_ger.plot, lr.opinion_6_ger.plot, lr.opinion_5_ger.plot, ncol=2)

# Print the grid (Figure S2):
print(leftright.grid_ger)

## APPENDIX 5: ROBUSTNESS CHECKS ##
## Before running the following models, please ensure that you have stacked the datasets and recoded the variables as described in 'data_analysis_maintext.R'

# If you have not already done so, filter out non-citizens from the Finnish data:
data_fin <- subset(data_fin, citizenship==1)

# ONLY THE EXPERIMENTAL ATTRIBUTES INCLUDED
# Finland:
model03_fin <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f,
                         data=data_fin,
                         clusters=ID, se_type="stata")
summary(model03_fin)

# Germany:
model03_ger <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f,
                         data=data_ger,
                         clusters=ID, se_type="stata")
summary(model03_ger)

# Results as Latex table (Table S9):
texreg(l=list(model03_fin, model03_ger),
       caption=" Regression results: Experimental attributes", 
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=FALSE,
       digits=3,
       custom.model.names=c("Finland", "Germany"),
       custom.coef.names=c("Intercept",
                           "No. of parties: Five",
                           "Party position: No PM",
                           "Party size: Small",
                           "Coalition agreement: Not included",
                           "Portfolio control: No",
                           "Other parties: Resist",
                           "No. of parties: Three"),
       reorder.coef=c(1,2,8,4,7,3,6,5))

# BACKGROUND VARIABLES

# Finland:
model04_fin <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f + opinion_ext_f
                         + governmentsupporter_f_Government
                         + leftright + trustparties
                         + agegroup4_f + edu3_f + female_f
                         + pledge_f + order_f,
                         data=data_fin, clusters=ID, se_type="stata")
summary(model04_fin)

# Results as Latex table (Table S10):
texreg(model04_fin, digits=3, 
       caption="Regression results with controls: Finland", 
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       custom.model.names=c("Beta (clust. SE"),
       custom.coef.names = c("Intercept",
                             "Number of parties: Five",
                             "Party status: Large, no PM",
                             "Party size: Small",
                             "Coalition agreement: Not included",
                             "Ministerial portfolio: No",
                             "Other parties: Resist",
                             "Personal opinion: Neutral",
                             "Personal opinion: Agree",
                             "Government supporter",
                             "Left-right",
                             "Trust in parties",
                             "Age: 35-49",
                             "Age: 50-64",
                             "Age: 65+",
                             "Education: Secondary",
                             "Education: Tertiary",
                             "Gender: Female",
                             "Pledge: Capital income tax",
                             "Pledge: Cannabis",
                             "Pledge: Fur farming",
                             "Pledge: Refugee quota",
                             "Pledge: Gender quotas",
                             "Vignette 2",
                             "Vignette 3",
                             "Vignette 4",
                             "Vignette 5",
                             "Vignette 6"),
       reorder.coef=c(1,2,4,7,3,6,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28))

# Germany:
model04_ger <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f + opinion_ext_f
                         + governmentsupporter_f_Government
                         + leftright + trustparties
                         + agegroup4_f + edu3_f + female_f
                         + pledge_f1 + order_f,
                         data=data_ger, clusters=ID, se_type="stata")
summary(model04_ger)

# Results as Latex table (Table S10):
texreg(model04_ger, digits=3, 
       caption="Regression results with controls: Germany", 
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       custom.model.names=c("Beta (clust. SE"),
       custom.coef.names = c("Intercept",
                             "Number of parties: Three",
                             "Party status: Junior partner",
                             "Coalition agreement: Not included",
                             "Ministerial portfolio: No",
                             "Other parties: Resist",
                             "Personal opinion: Neutral",
                             "Personal opinion: Agree",
                             "Government supporter",
                             "Left-right",
                             "Trust in parties",
                             "Age: 35-49",
                             "Age: 50-64",
                             "Age: 65+",
                             "Education: Secondary",
                             "Education: Tertiary",
                             "Gender: Female",
                             "Pledge: Military service",
                             "Pledge: Unemployment benefits",
                             "Pledge: Speed limit",
                             "Pledge: Debt brake",
                             "Pledge: Gender quotas",
                             "Vignette 2",
                             "Vignette 3",
                             "Vignette 4",
                             "Vignette 5",
                             "Vignette 6"),
       reorder.coef=c(1,2,6,3,5,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27))

# THE ORIGINAL SCALE OF THE OUTCOME VARIABLE

# Finland:
model05_fin <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f + opinion_f 
                         + pledge_f + order_f,
                         data=data_fin, clusters=ID, se_type="stata")
summary(model05_fin)

# Results as Latex table (Table S12):
texreg(model05_fin, digits=3,
       caption="Regression results with the original issue opinion variable: Finland",
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       custom.model.names="Beta (clust. SE)",
       custom.coef.names = c("Intercept",
                             "Number of parties: Five",
                             "Party status: Large, no PM",
                             "Party size: Small",
                             "Coalition agreement: Not included",
                             "Portfolio control: No",
                             "Other parties: Resist",
                             "Opinion: Somewhat disagree",
                             "Opinion: Neither agree nor disagree",
                             "Opinion: Somewhat agree",
                             "Opinion: Fully agree",
                             "Pledge: Capital income tax",
                             "Pledge: Cannabis",
                             "Pledge: Fur farming",
                             "Pledge: Refugee quota",
                             "Pledge: Gender quotas",
                             "Vignette 2",
                             "Vignette 3",
                             "Vignette 4",
                             "Vignette 5",
                             "Vignette 6"))

# Germany:
model05_ger <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f + opinion_f 
                         + pledge_f1 + order_f,
                         data=data_ger, clusters=ID, se_type="stata")
summary(model05_ger)

# Results as Latex table (Table S13):
texreg(model05_ger, digits=3,
       caption="Regression results with the original issue opinion variable: Germany",
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       custom.model.names="Beta (clust. SE)",
       custom.coef.names = c("Intercept",
                             "Number of parties: Three", 
                             "Party status: Junior partner",
                             "Coalition agreement: Not included",
                             "Portfolio control: No",
                             "Other parties: Resist",
                             "Opinion: Somewhat disagree",
                             "Opinion: Neither agree nor disagree",
                             "Opinion: Somewhat agree",
                             "Opinion: Fully agree",
                             "Pledge: Military service",
                             "Pledge: Unemployment benefits",
                             "Pledge: Speed limit",
                             "Pledge: Debt brake",
                             "Pledge: Gender quotas",
                             "Vignette 2",
                             "Vignette 3",
                             "Vignette 4",
                             "Vignette 5",
                             "Vignette 6"))

# THE IMPORTANCE OF THE POLICY AREA

# Finland, additive model:
model06_fin <- lm_robust(outcome ~ size_f + position_f + program_f
                         + ministry_f + others_f + opinion_ext_f + importance
                         + pledge_f + order_f, 
                         data=data_fin, clusters=ID, se_type="stata")
summary(model06_fin)

# Finland, interaction model:
model07_fin <- lm_robust(outcome ~ size_f * opinion_ext_f
                         + position_f * opinion_ext_f
                         + program_f * opinion_ext_f
                         + ministry_f * opinion_ext_f
                         + others_f *opinion_ext_f + opinion_ext_f 
                         + importance
                         + pledge_f
                         + order_f, 
                         data=data_fin, clusters=ID, se_type="stata")
summary(model07_fin)

# Results as Latex table (Table S14):
texreg(l=list(model06_fin, model07_fin),
       caption.above=TRUE,
       single.row=TRUE,
       include.ci=FALSE,
       digits=3,
       caption="Regression results with the importance of the policy area: Finland",
       custom.model.names=c("No interactions", "With interactions"),
       custom.coef.names=c("Intercept",
                           "Number of parties: Five",
                           "Party status: Large, no PM",
                           "Party size: Small",
                           "Coalition agreement: Not included",
                           "Portfolio control: No",
                           "Other parties: Resist",
                           "Opinion: Neutral",
                           "Opinion: Agree",
                           "Importance",
                           "Pledge: Capital income tax",
                           "Pledge: Cannabis",
                           "Pledge: Fur farming",
                           "Pledge: Refugee quota",
                           "Pledge: Gender quotas",
                           "Vignette 2",
                           "Vignette 3",
                           "Vignette 4",
                           "Vignette 5",
                           "Vignette 6",
                           "Number of parties: Five * Opinion: Neutral",
                           "Number of parties: Five * Opinion: Agree",
                           "Party status: Large, no PM * Opinion: Neutral",
                           "Party status: Large, no PM * Opinion: Agree",
                           "Party size: Small * Opinion: Neutral",
                           "Party size: Small * Opinion: Agree",
                           "Coalition agreement: Not included * Opinion: Neutral",
                           "Coalition agreement: Not included * Opinion: Agree",
                           "Portfolio control: No * Opinion: Neutral",
                           "Portfolio control: No * Opinion: Agree",
                           "Other parties: Resist * Opinion: Neutral",
                           "Other parties: Resist * Opinion: Agree"),
       reorder.coef=c(1,2,4,7,3,6,5,10,8,9,21,22,25,26,31,32,23,24,29,30,27,28,
                      11,12,13,14,15,16,17,18,19,20))

# Germany, additive model:
model06_ger <- lm_robust(outcome ~ size_f + position_f + program_f 
                         + ministry_f + others_f + importance + opinion_ext_f 
                         + pledge_f1 + order_f, data=data_ger, 
                         clusters=ID, se_type="stata")
summary(model06_ger)

# Germany, interaction model:
model07_ger <- lm_robust(outcome ~ size_f * opinion_ext_f 
                         + position_f * opinion_ext_f
                         + program_f  * opinion_ext_f
                         + ministry_f * opinion_ext_f
                         + others_f * opinion_ext_f
                         + importance + opinion_ext_f 
                         + pledge_f1 + order_f, 
                         data=data_ger, clusters=ID, se_type="stata")
summary(model07_ger)

# Results as Latex table (Table S15):
texreg(l=list(model06_ger, model07_ger),
       caption.above=TRUE,
       single.row=TRUE,
       include.ci=FALSE,
       digits=3,
       caption="Regression results with the importance of the policy area: Germany",
       custom.model.names=c("No interactions", "With interactions"),
       custom.coef.names=c("Intercept",
                           "Number of parties: Three",
                           "Party status: Junior partner",
                           "Coalition agreement: Not included",
                           "Portfolio control: No",
                           "Other parties: Resist",
                           "Importance",
                           "Opinion: Neutral",
                           "Opinion: Agree",
                           "Pledge: Military service",
                           "Pledge: Unemployment benefits",
                           "Pledge: Speed limit",
                           "Pledge: Debt brake",
                           "Pledge: Gender quotas",
                           "Vignette 2",
                           "Vignette 3",
                           "Vignette 4",
                           "Vignette 5",
                           "Vignette 6",
                           "Number of parties: Three * Opinion: Neutral",
                           "Number of parties: Three * Opinion: Agree",
                           "Party status: Junior partner * Opinion: Neutral",
                           "Party status: Junior partner * Opinion: Agree",
                           "Coalition agreement: Not included * Opinion: Neutral",
                           "Coalition agreement: Not included * Opinion: Agree",
                           "Portfolio control: No * Opinion: Neutral",
                           "Portfolio control: No * Opinion: Agree",
                           "Other parties: Resist * Opinion: Neutral",
                           "Other parties: Resist * Opinion: Agree"),
       reorder.coef=c(1,2,6,3,5,4,7,8,9,20,21,28,29,22,23,26,27,24,25,
                      10,11,12,13,14,15,16,17,18,19))

# Germany, controlling for the ranked importance of the issue area:
model08_ger <- lm_robust(outcome ~ size_f + position_f + program_f 
                         + ministry_f + others_f + importancerank_f + opinion_ext_f 
                         + pledge_f1 + order_f, data=data_ger, 
                         clusters=ID, se_type="stata")
summary(model08_ger)

# Results as Latex table (Table S16):
texreg(model08_ger,
       caption.above=TRUE,
       single.row=TRUE,
       include.ci=FALSE,
       digits=3,
       caption="Regression results with the ranked importance of the policy area: Germany",
       custom.model.names="Beta (clust. SE)",
       custom.coef.names=c("Intercept",
                           "Number of parties: Three",
                           "Party status: Junior partner",
                           "Coalition agreement: Not included",
                           "Portfolio control: No",
                           "Other parties: Resist",
                           "Importance rank:2",
                           "Importance rank:3",
                           "Importance rank:4",
                           "Importance rank:5",
                           "Importance rank:6",
                           "Opinion: Neutral",
                           "Opinion: Agree",
                           "Pledge: Military service",
                           "Pledge: Unemployment benefits",
                           "Pledge: Speed limit",
                           "Pledge: Debt brake",
                           "Pledge: Gender quotas",
                           "Vignette 2",
                           "Vignette 3",
                           "Vignette 4",
                           "Vignette 5",
                           "Vignette 6"),
       reorder.coef=c(1,2,6,3,5,4,7,8,9,10,11,12,13,14,15,16,
                      17,18,19,20,21,22,23))

# THE EXCLUSION OF A SUBSET OF OBSERVATIONS
# Filter out those who always gave the same acceptability evaluation:

# Finland, additive model:
model08_fin <- lm_robust(outcome ~ size_f + position_f + others_f + ministry_f
                         + program_f + others_f + opinion_ext_f
                         + pledge_f + order_f, 
                         data=subset(data_fin, equalresp==FALSE),
                         clusters=ID, se_type="stata")
summary(model08_fin)

# Finland, interaction model:
model09_fin <- lm_robust(outcome ~ size_f * opinion_ext_f
                         + position_f * opinion_ext_f
                         + others_f * opinion_ext_f
                         + ministry_f * opinion_ext_f
                         + program_f * opinion_ext_f
                         + others_f * opinion_ext_f
                         + opinion_ext_f
                         + pledge_f + order_f, 
                         data=subset(data_fin, equalresp==FALSE), 
                         clusters=ID, se_type="stata")
summary(model09_fin)

# Results as Latex table (Table S17):
texreg(l=list(model08_fin, model09_fin),
       caption="Regression results with a subset of observations excluded: Finland", 
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       digits=3,
       custom.model.names=c("No interactions", "With interactions"),
       custom.note = "Note: The respondents who made an identical acceptability evaluation on each round or did not answer the question in every vignette (n = 89) are excluded. Clustered standard errors in parentheses. %stars",
       custom.coef.names=c("Intercept",
                           "Number of parties: Five",
                           "Party status: Large, no PM",
                           "Party size: Small",
                           "Other parties: Resist",
                           "Ministerial portfolio: No",
                           "Coalition agreement: Not included",
                           "Opinion: Neutral",
                           "Opinion: Agree",
                           "Pledge: Capital gains tax",
                           "Pledge: Cannabis",
                           "Pledge: Fur farming",
                           "Pledge: Refugee quota",
                           "Pledge: Gender quotas",
                           "Vignette 2",
                           "Vignette 3",
                           "Vignette 4",
                           "Vignette 5",
                           "Vignette 6",
                           "Number of parties: Five * Opinion: Neutral",
                           "Number of parties: Five * Opinion: Agree",
                           "Party position: Large, no PM * Opinion: Neutral",
                           "Party position: Large, no PM * Opinion: Agree",
                           "Party size: Small * Opinion: Neutral",
                           "Party size: Small * Opinion: Agree",
                           "Other parties: Resist * Opinion: Neutral",
                           "Other parties: Resist * Opinion: Agree",
                           "Ministerial portfolio: No * Opinion: Neutral",
                           "Ministerial portfolio: No * Opinion: Agree",
                           "Coalition agreement: Not included * Opinion: Neutral",
                           "Coalition agreement: Not included * Opinion: Agree"),
       reorder.coef=c(1,2,4,5,3,6,7,8,9,
                      20,21,24,25,26,27,22,23,28,29,30,31,
                      10,11,12,13,14,15,16,17,18,19))

# Germany, additive model:
model09_ger <- lm_robust(outcome ~ size_f 
                         + others_f 
                         + position_f 
                         + ministry_f
                         + program_f
                         + opinion_ext_f 
                         + pledge_f1 
                         + order_f, 
                         data=subset(data_ger, equalresp=="FALSE"), 
                         clusters=ID, se_type="stata")
summary(model09_ger)

# Germany, interaction model:

model10_ger <- lm_robust(outcome ~ opinion_ext_f * size_f 
                         + opinion_ext_f * others_f
                         + opinion_ext_f * position_f
                         + opinion_ext_f * ministry_f  
                         + opinion_ext_f * program_f
                         + pledge_f1 + order_f, 
                         data=subset(data_ger, equalresp=="FALSE"), 
                         clusters=ID, se_type="stata")
summary(model10_ger)

# Results as Latex table (Table S18):
texreg(l=list(model09_ger, model10_ger),
       caption="Regression results with a subset of observations excluded: Germany", 
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       digits=3,
       custom.model.names=c("No interactions", "With interactions"),
       custom.note = "Note: The respondents who made an identical acceptability evaluation on each round (n = 140) are excluded. Clustered standard errors in parentheses. %stars",
       custom.coef.names = c("Intercept",
                             "Number of parties: Three",
                             "Other parties: Resist",
                             "Party position: Junior partner",
                             "Ministerial portfolio: No",
                             "Coalition agreement: Not included",
                             "Opinion: Neutral",
                             "Opinion: Agree",
                             "Pledge: Military service",
                             "Pledge: Unemployment benefits",
                             "Pledge: Speed limit",
                             "Pledge: Debt brake",
                             "Pledge: Gender quotas",
                             "Vignette 2",
                             "Vignette 3",
                             "Vignette 4",
                             "Vignette 5",
                             "Vignette 6",
                             "Number of parties: Three * Opinion: Neutral",
                             "Number of parties: Three * Opinion: Agree",
                             "Other parties: Resist * Opinion: Neutral",
                             "Other parties: Resist * Opinion: Agree",
                             "Party position: Junior partner * Opinion: Neutral",
                             "Party position: Junior partner * Opinion: Agree",
                             "Ministerial portfolio: No * Opinion: Neutral",
                             "Ministerial portfolio: No * Opinion: Agree",
                             "Coalition agreement: Not included * Opinion: Neutral",
                             "Coalition agreement: Not included * Opinion: Agree"),
       reorder.coef=c(1,2,3,4,5,6,7,8,19,20,21,22,23,24,
                      25,26,27,28,9,10,11,12,13,14,15,16,17,18)
)

# ANALYZING ONE PLEDGE AT A TIME

# Figure S3: Regression results: Explaining acceptability of non-fulfillment, pledges 1–3 (Finland)

# Additive models, one pledge at a time:
# Unemployment benefits:
pledge1_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_fin, pledge==1))
summary(pledge1_fin)

# Capital gains tax:
pledge2_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_fin, pledge==2))
summary(pledge2_fin)

# Cannabis:
pledge3_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_fin, pledge==3))
summary(pledge3_fin)

# Plot model estimates:
fin_pledges123 <- plot_models(pledge3_fin, pledge2_fin, pledge1_fin,
                              prefix.labels="label",
                              show.p=F,
                              show.values=F,
                              m.labels=c("Cannabis", "Capital gains tax", "Unemployment benefits"),
                              show.legend=FALSE,
                              colors="bw",
                              vline.color="grey",
                              grid=TRUE,
                              value.size=3.5,
                              dot.size=2.5,
                              rm.terms=c(
                                "order_f2", 
                                "order_f3", 
                                "order_f4", 
                                "order_f5", 
                                "order_f6"
                              )) + theme_sjplot2()

# Rearrange coefficients:
fin_pledges123$data <- transform(fin_pledges123$data,
                                 term = factor(
                                   term, levels = c(
                                     "opinion_ext_fAgree",
                                     "opinion_ext_fNeutral",
                                     "program_fNot included",
                                     "ministry_fNo",
                                     "position_fNo_PM",
                                     "others_fResist",
                                     "position_fSmall",
                                     "size_fFive"),
                                   labels=c("Personal opinion: Agree",
                                            "Personal opinion: Neutral",
                                            "Not included in coalition agreement",
                                            "No portfolio control",
                                            "Party status: Large, no PM",
                                            "Disagreement\n in government",
                                            "Party size: Small",
                                            "Number of parties: Five"
                                   )))
# Print the combined plot (Figure S3):
print(fin_pledges123)

# Figure S4: Regression results: Explaining acceptability of non-fulfillment, pledges 4–6 (Finland)

# Additive models, one pledge at a time:
# Fur farming:
pledge4_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_fin, pledge==4))
summary(pledge4_fin)

# Refugee quota:
pledge5_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_fin, pledge==5))
summary(pledge5_fin)

# Gender quotas:
pledge6_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_fin, pledge==6))
summary(pledge6_fin)

# Plot model estimates:
fin_pledges456 <- plot_models(pledge6_fin, pledge5_fin, pledge4_fin,
                              prefix.labels="label",
                              show.p=F,
                              show.values=F,
                              m.labels=c("Gender quotas", "Refugee quota", "Fur farming"),
                              show.legend=FALSE,
                              colors="bw",
                              vline.color="grey",
                              grid=TRUE,
                              value.size=3.5,
                              dot.size=2.5,
                              rm.terms=c(
                                "order_f2", 
                                "order_f3", 
                                "order_f4", 
                                "order_f5", 
                                "order_f6"
                              )) + theme_sjplot2()

# Rearrange coefficients:
fin_pledges456$data <- transform(fin_pledges456$data,
                                 term = factor(
                                   term, levels = c(
                                     "opinion_ext_fAgree",
                                     "opinion_ext_fNeutral",
                                     "program_fNot included",
                                     "ministry_fNo",
                                     "position_fNo_PM",
                                     "others_fResist",
                                     "position_fSmall",
                                     "size_fFive"),
                                   labels=c("Personal opinion: Agree",
                                            "Personal opinion: Neutral",
                                            "Not included in coalition agreement",
                                            "No portfolio control",
                                            "Party status: Large, no PM",
                                            "Disagreement\n in government",
                                            "Party size: Small",
                                            "Number of parties: Five"
                                   )))
# Print the combined plot (Figure S4):
print(fin_pledges456)

# Figure S5: Regression results: Explaining acceptability of non-fulfillment, pledges 1–3 (Germany)

# Additive models, one pledge at a time:
# Military service:
pledge1_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_ger, pledge==1))
summary(pledge1_ger)

# Unemployment benefits:
pledge2_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_ger, pledge==2))
summary(pledge2_ger)

# Speed limit:
pledge3_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_ger, pledge==3))
summary(pledge3_ger)

# Plot model estimates:
ger_pledges123 <- plot_models(pledge3_ger, pledge2_ger, pledge1_ger, 
                              prefix.labels="label", 
                              show.p=F, 
                              show.values=F,
                              m.labels=c("Speed limit", "Unemployment benefits", "Military service"),
                              show.legend=FALSE,
                              colors="bw",
                              vline.color="grey",
                              grid=TRUE,
                              value.size=3.5,
                              dot.size=2.5,
                              rm.terms=c(
                                "order_f2", 
                                "order_f3", 
                                "order_f4", 
                                "order_f5", 
                                "order_f6"
                              )) + theme_sjplot2()

# Rearrange coefficients:
ger_pledges123$data <- transform(ger_pledges123$data, 
                                 term = factor(term, levels = c("opinion_ext_fAgree",
                                                                "opinion_ext_fNeutral",
                                                                "program_fNot included",
                                                                "ministry_fNo",
                                                                "position_fNo_PM",
                                                                "others_fResist",
                                                                "size_fThree"),
                                               labels=c("Personal opinion: Agree",
                                                        "Personal opinion: Neutral",
                                                        "Not included in coalition agreement",
                                                        "No portfolio control",
                                                        "Party status: Junior partner",
                                                        "Disagreement\n in government",
                                                        "Number of parties: Three"
                                               )))

# Print the combined plot (Figure S5):
print(ger_pledges123)

# Figure S6: Regression results: Explaining acceptability of non-fulfillment, pledges 4–6 (Germany)

## Additive models, one pledge at a time:
# Debt brake:
pledge4_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_ger, pledge==4))
summary(pledge4_ger)

# Number of refugees:
pledge5_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_ger, pledge==5))
summary(pledge5_ger)

# Gender quotas:
pledge6_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                  + others_f + opinion_ext_f + order_f, 
                  data=subset(data_ger, pledge==6))
summary(pledge6_ger)

# Plot model estimates:
ger_pledges456 <- plot_models(pledge6_ger, pledge5_ger, pledge4_ger, 
                              prefix.labels="label", 
                              show.p=F, 
                              show.values=F,
                              m.labels=c("Gender quotas", "Number of refugees", "Debt brake"),
                              show.legend=FALSE,
                              colors="bw",
                              vline.color="grey",
                              grid=TRUE,
                              value.size=3.5,
                              dot.size=2.5,
                              rm.terms=c(
                                "order_f2", 
                                "order_f3", 
                                "order_f4", 
                                "order_f5", 
                                "order_f6"
                              )) + theme_sjplot2()

# Rearrange coefficients:
ger_pledges456$data <- transform(ger_pledges456$data, 
                                 term = factor(term, levels = c("opinion_ext_fAgree",
                                                                "opinion_ext_fNeutral",
                                                                "program_fNot included",
                                                                "ministry_fNo",
                                                                "position_fNo_PM",
                                                                "others_fResist",
                                                                "size_fThree"),
                                               labels=c("Personal opinion: Agree",
                                                        "Personal opinion: Neutral",
                                                        "Not included in coalition agreement",
                                                        "No portfolio control",
                                                        "Party status: Junior partner",
                                                        "Disagreement\n in government",
                                                        "Number of parties: Three"
                                               )))

# Print the combined plot (Figure S6):
print(ger_pledges456)

# ANALYZING ONE VIGNETTE AT A TIME

# Figure S7: Regression results: Explaining acceptability of non-fulfillment, vignettes 1, 4 and 6 (Finland)

# Additive models, one vignette at a time:
vignette1_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                    + others_f + opinion_ext_f + pledge_f, 
                    data=subset(data_fin, order==1))
summary(vignette1_fin)

vignette4_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                    + others_f + opinion_ext_f + pledge_f, 
                    data=subset(data_fin, order==4))
summary(vignette4_fin)

vignette6_fin <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                    + others_f + opinion_ext_f + pledge_f, 
                    data=subset(data_fin, order==6))
summary(vignette6_fin)

# Plot model estimates:
fin_rounds146 <- plot_models(vignette6_fin, vignette4_fin, vignette1_fin,
                             prefix.labels="label",
                             show.p=F,
                             show.values=F,
                             m.labels=c("6th vignette", "4th vignette", "1st vignette"),
                             show.legend=FALSE,
                             colors="bw",
                             vline.color="grey",
                             grid=TRUE,
                             value.size=3.5,
                             dot.size=2.5,
                             rm.terms=c(
                               "pledge_fCapital income tax",
                               "pledge_fCannabis",
                               "pledge_fFur farming",
                               "pledge_fRefugee quota",
                               "pledge_fGender quotas"
                             )) + theme_sjplot2()

# Rearrange coefficients:
fin_rounds146$data <- transform(fin_rounds146$data, 
                                term = factor(term, levels = c("opinion_ext_fAgree",
                                                               "opinion_ext_fNeutral",
                                                               "program_fNot included",
                                                               "ministry_fNo",
                                                               "position_fNo_PM",
                                                               "others_fResist",
                                                               "position_fSmall",
                                                               "size_fFive"),
                                              labels=c("Personal opinion: Agree",
                                                       "Personal opinion: Neutral",
                                                       "Not included in coalition agreement",
                                                       "No portfolio control",
                                                       "Party status: Large, no PM",
                                                       "Disagreement\n in government",
                                                       "Party size: Small",
                                                       "Number of parties: Five"
                                              )))

# Print the combined plot (Figure S7):
print(fin_rounds146)

# Figure S8: Regression results: Explaining acceptability of non-fulfillment, vignettes 1, 4 and 6 (Germany)

# Additive models, one vignette at a time:
vignette1_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                    + others_f + opinion_ext_f + pledge_f1, 
                    data=subset(data_ger, order==1))
summary(vignette1_ger)

vignette4_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                    + others_f + opinion_ext_f + pledge_f1, 
                    data=subset(data_ger, order==4))
summary(vignette4_ger)

vignette6_ger <- lm(outcome ~ size_f + position_f + program_f + ministry_f 
                    + others_f + opinion_ext_f + pledge_f1, 
                    data=subset(data_ger, order==6))
summary(vignette6_ger)

# Plot model estimates:
ger_rounds146 <- plot_models(vignette6_ger, vignette4_ger, vignette1_ger,
                             prefix.labels="label",
                             show.p=F,
                             show.values=F,
                             m.labels=c("6th vignette", "4th vignette", "1st vignette"),
                             show.legend=FALSE,
                             colors="bw",
                             vline.color="grey",
                             grid=TRUE,
                             value.size=3.5,
                             dot.size=2.5,
                             rm.terms=c(
                               "pledge_f1Military service",
                               "pledge_f1Unemployment benefits",
                               "pledge_f1Speed limit",
                               "pledge_f1Debt brake",
                               "pledge_f1Gender quotas"
                             )) + theme_sjplot2()

# Rearrange coefficients:
ger_rounds146$data <- transform(ger_rounds146$data, 
                                term = factor(term, levels = c("opinion_ext_fAgree",
                                                               "opinion_ext_fNeutral",
                                                               "program_fNot included",
                                                               "ministry_fNo",
                                                               "position_fNo_PM",
                                                               "others_fResist",
                                                               "size_fThree"),
                                              labels=c("Personal opinion: Agree",
                                                       "Personal opinion: Neutral",
                                                       "Not included in coalition agreement",
                                                       "No portfolio control",
                                                       "Party status: Junior partner",
                                                       "Disagreement\n in government",
                                                       "Number of parties: Three"
                                              )))

# Print combined plot (Figure S8):
print(ger_rounds146)

## APPENDIX 6: PROPENSITY TO VOTE AS THE OUTCOME VARIABLE

# Import the German dataset with a modified outcome variable:
data_ger_ptv_wide <- read_excel("data_ger_ptv_wide.xlsx")

# Make the dataset a "data table":
data_ger_ptv_wide.dt <- data.table(data_ger_ptv_wide)

# STACKING THE DATASET
# Recode NA cells to 9999:
data_ger_ptv_wide.dt[is.na(data_ger_ptv_wide.dt)] <- 9999

# Transform the data into a 'long' i.e. stacked format and name it 'data_ger_ptv'
# There should be 4721*6=28326 rows in the new dataset
# Variable 'pledge' (timevar) does not exist yet, running this piece of code will create it:
data_ger_ptv <- reshape(data_ger_ptv_wide.dt, varying=list(
  opinion = c("opinion_1", "opinion_2", "opinion_3", "opinion_4", "opinion_5", "opinion_6"), 
  outcome = c("outcome_1", "outcome_2", "outcome_3", "outcome_4", "outcome_5", "outcome_6"), 
  size = c("size_1", "size_2", "size_3", "size_4", "size_5", "size_6"), 
  position = c("position_1", "position_2", "position_3","position_4", "position_5", "position_6"), 
  program = c("program_1", "program_2", "program_3", "program_4", "program_5", "program_6"), 
  ministry = c("ministry_1", "ministry_2", "ministry_3", "ministry_4", "ministry_5", "ministry_6"), 
  others = c("others_1", "others_2", "others_3", "others_4", "others_5", "others_6"),
  order = c("view_order_Vignette1", "view_order_Vignette2", "view_order_Vignette3", "view_order_Vignette4", "view_order_Vignette5", "view_order_Vignette6")
),
v.names=c("opinion", "outcome", "size", "position", "program", "ministry", "others", "order"), 
timevar="pledge", 
times=c(1,2,3,4,5,6), 
idvar="ID",  
direction="long")

# make 9999 cells NAs again:
data_ger_ptv_wide.dt[data_ger_ptv_wide.dt == 9999] <- NA
data_ger_ptv[data_ger_ptv == 9999] <- NA

# VARIABLE RECODING

# Recode experimental attributes as factors:
data_ger_ptv$size_f <- factor(data_ger_ptv$size, levels=c(1, 2), 
                              labels=c("Two", "Three"))
data_ger_ptv$position_f <- factor(data_ger_ptv$position, levels=c(1, 2), 
                                  labels=c("PM", "No PM"))
data_ger_ptv$program_f <- factor(data_ger_ptv$program, levels=c(1, 2), 
                                 labels=c("Included", "Not included"))
data_ger_ptv$ministry_f <- factor(data_ger_ptv$ministry, levels=c(1, 2), 
                                  labels=c("Yes", "No"))
data_ger_ptv$others_f <- factor(data_ger_ptv$others, levels=c(1, 2), 
                                labels=c("Support", "Resist"))

# Give the experimental attributes variable labels:
data_ger_ptv$size_f <- set_label(data_ger_ptv$size_f, "No. of parties")
data_ger_ptv$position_f <- set_label(data_ger_ptv$position_f, "Position")
data_ger_ptv$program_f <- set_label(data_ger_ptv$program_f, "Coalition agreement")
data_ger_ptv$ministry_f <- set_label(data_ger_ptv$ministry_f, "Portfolio control")
data_ger_ptv$others_f <- set_label(data_ger_ptv$others_f, "Other parties")

# Recode the 'pledge' variable into a labelled factor:
data_ger_ptv$pledge_f <- factor(data_ger_ptv$pledge, levels=c(1,2,3,4,5,6), 
                                labels=c("Military service", "Unemployment benefits", 
                                         "Speed limit", "Debt brake", 
                                         "Number of refugees", "Gender quotas"))
# Change the reference category --> the coefficients on the other pledges become positive:
data_ger_ptv$pledge_f1 <- factor(data_ger_ptv$pledge, levels=c(5,1,2,3,4,6), 
                                 labels=c("Number of refugees", "Military service", 
                                          "Unemployment benefits", "Speed limit", 
                                          "Debt brake", "Gender quotas"))
# Set variable label:
data_ger_ptv$pledge_f1 <- set_label(data_ger_ptv$pledge_f1, "Pledge")

# Opinion variable as categorical
# Recode 'opinion' into a factor:
data_ger_ptv$opinion_f <- factor(data_ger_ptv$opinion, levels=c(5,4,3,2,1), 
                                 labels=c("Fully disagree", "Somewhat disagree", 
                                          "Neither agree nor disagree", 
                                          "Somewhat agree", "Fully agree"))

# 'opinion' factor with somewhat shorter value labels:
data_ger_ptv$opinion_f2 <- factor(data_ger_ptv$opinion, levels=c(5,4,3,2,1), 
                                  labels=c("FD", "SD", "NAND", "SA", "FA"))
data_ger_ptv$opinion_f2 <- set_label(data_ger_ptv$opinion_f2, "Personal opinion")

# Differentiate those who agree or disagree from those who are neutral:
data_ger_ptv$opinion_ext_f <- fct_collapse(data_ger_ptv$opinion_f, 
                                           Agree = c("Fully agree", "Somewhat agree"), 
                                           Disagree = c("Somewhat disagree", 
                                                        "Fully disagree"), 
                                           Neutral = c("Neither agree nor disagree"))
# Change the reference category to 'disagree':
data_ger_ptv$opinion_ext_f <- factor(data_ger_ptv$opinion_ext_f, 
                                     levels=c("Disagree", "Neutral", "Agree"))
# Set variable label:
data_ger_ptv$opinion_ext_f <- set_label(data_ger_ptv$opinion_ext_f, "Personal opinion")

# Vignette order factor:
data_ger_ptv$order_f <- factor(data_ger_ptv$order,
                               levels=c(1,2,3,4,5,6),
                               labels=c("1","2","3","4","5","6"))
data_ger_ptv$order_f <- set_label(data_ger_ptv$order_f, "Vignette")

# ANALYSES

# Mean of the propensity to vote (PTV) variable:
mean(data_ger_ptv$outcome, na.rm = T)

# Standard deviation of the PTV variable:
sd(data_ger_ptv$outcome, na.rm = T)

# Figure S9: Distribution of the outcome variable: Propensity to vote

outcome.hist.ptv.de <- ggplot(
  data_ger_ptv, aes(x=outcome)
) + geom_histogram(binwidth=1,
                   color="black",
                   fill="grey",
                   aes(y=after_stat(count/sum(count)))
) + scale_x_continuous(breaks=c(0,1,2,3,4,5,6,7,8,9,10)
) + scale_y_continuous(labels=scales::percent, limits=c(0, 0.25))  + labs(title="", x="Propensity to vote", y="") + theme_classic() + theme(plot.title=element_text(size=10)) + theme(axis.title.x = element_text(size=10))

print(outcome.hist.ptv.de)

# Regression model with clustered standard errors:
model01_ger_ptv <- lm_robust(outcome ~ size_f
                             + others_f
                             + position_f
                             + ministry_f
                             + program_f 
                             + opinion_ext_f 
                             + pledge_f1 
                             + order_f,
                             data=data_ger_ptv, clusters=ID, se_type="stata")
summary(model01_ger_ptv)

# Interaction model:
model02_ger_ptv <- lm_robust(outcome ~ size_f * opinion_ext_f
                             + others_f * opinion_ext_f
                             + position_f * opinion_ext_f
                             + ministry_f * opinion_ext_f
                             + program_f  * opinion_ext_f
                             + opinion_ext_f 
                             + pledge_f1 
                             + order_f,
                             data=data_ger_ptv, clusters=ID, se_type="stata")
summary(model02_ger_ptv)

# Results as Latex table (Table S19):
texreg(l=list(model01_ger_ptv, model02_ger_ptv),
       caption="Regression results. Outcome variable: propensity to vote", 
       caption.above=TRUE,
       include.ci=FALSE,
       single.row=TRUE,
       digits=3,
       custom.model.names=c("No interactions", "With interactions"),
       custom.coef.names = c("Intercept",
                             "Number of parties: Three",
                             "Other parties: Resist",
                             "Party position: Junior partner",
                             "Ministerial portfolio: No",
                             "Coalition agreement: Not included",
                             "Opinion: Neutral",
                             "Opinion: Agree",
                             "Pledge: Military service",
                             "Pledge: Unemployment benefits",
                             "Pledge: Speed limit",
                             "Pledge: Debt brake",
                             "Pledge: Gender quotas",
                             "Vignette 2",
                             "Vignette 3",
                             "Vignette 4",
                             "Vignette 5",
                             "Vignette 6",
                             "Number of parties: Three * Opinion: Neutral",
                             "Number of parties: Three * Opinion: Agree",
                             "Other parties: Resist * Opinion: Neutral",
                             "Other parties: Resist * Opinion: Agree",
                             "Party position: Junior partner * Opinion: Neutral",
                             "Party position: Junior partner * Opinion: Agree",
                             "Ministerial portfolio: No * Opinion: Neutral",
                             "Ministerial portfolio: No * Opinion: Agree",
                             "Coalition agreement: Not included * Opinion: Neutral",
                             "Coalition agreement: Not included * Opinion: Agree"),
       reorder.coef=c(1,2,3,4,5,6,7,8,19,20,21,22,23,24,
                      25,26,27,28,9,10,11,12,13,14,15,16,17,18)
)

# Plot the results of model01_ger_ptv (Figure S10):
model01_ger_ptv.plot <- plot_model(model01_ger_ptv,
                                   prefix.labels="label",
                                   show.legend=FALSE,
                                   show.p=TRUE, 
                                   show.values=TRUE,
                                   value.offset=.4,
                                   value.size=3,
                                   rm.terms=c("pledge_f1Military service",
                                              "pledge_f1Unemployment benefits", 
                                              "pledge_f1Speed limit",
                                              "pledge_f1Debt brake", 
                                              "pledge_f1Gender quotas",
                                              "order_f2",
                                              "order_f3",
                                              "order_f4",
                                              "order_f5",
                                              "order_f6"
                                   ),
                                   colors="bw", vline.color="grey") + labs(title="") + theme_sjplot2()

# # Transform the data of the combined plot to rearrange the coefficients and exclude the fixed effects:
model01_ger_ptv.plot$data <- transform(model01_ger_ptv.plot$data, 
                                       term = factor(term, levels = c("opinion_ext_fAgree",
                                                                      "opinion_ext_fNeutral",
                                                                      "program_fNot included",
                                                                      "ministry_fNo",
                                                                      "position_fNo PM",
                                                                      "others_fResist",
                                                                      "size_fThree"),
                                                     labels=c("Personal opinion: Agree",
                                                              "Personal opinion: Neutral",
                                                              "Not included in coalition agreement",
                                                              "No portfolio control",
                                                              "Party status: Junior partner",
                                                              "Disagreement\n in government",
                                                              "Number of parties: Three"
                                                     )))

# Print the transformed plot:
print(model01_ger_ptv.plot)
